%%{init: {'themeVariables': { 'fontSize': '12px'}}}%%
graph TD
    classDef path fill:#eee,stroke:#000,color:#000
    classDef plan fill:#fff,stroke-width:1px,color:#000
    classDef itemplan fill:#fff,stroke-width:2px,color:#000
    classDef unbatchedplan fill:#dff,stroke-width:1px,color:#000
    classDef sideeffectplan fill:#fcc,stroke-width:2px,color:#000
    classDef bucket fill:#f6f6f6,color:#000,stroke-width:2px,text-align:left

    subgraph "Buckets for queries/functions/custom-query-scalar"
    Bucket0("Bucket 0 (root)<br /><br />1: <br />ᐳ: 6, 8, 9, 32, 33, 10, 11, 19, 27<br />2: PgSelect[7], PgSelect[17], PgSelect[25]<br />3: 13, 21, 29<br />ᐳ: 12, 14, 15, 20, 22, 23, 28, 30, 31"):::bucket
    end

    %% plan dependencies
    PgSelect7[["PgSelect[7∈0] ➊<br />ᐸunique_author_countᐳ"]]:::plan
    Object10{{"Object[10∈0] ➊<br />ᐸ{pgSettings,withPgClient}ᐳ"}}:::plan
    PgFromExpression11{{"PgFromExpression[11∈0] ➊<br />More deps:<br />- Constantᐸundefinedᐳ[6]"}}:::plan
    Object10 & PgFromExpression11 --> PgSelect7
    Access8{{"Access[8∈0] ➊<br />ᐸ2.pgSettingsᐳ"}}:::plan
    Access9{{"Access[9∈0] ➊<br />ᐸ2.withPgClientᐳ"}}:::plan
    Access8 & Access9 --> Object10
    PgSelect17[["PgSelect[17∈0] ➊<br />ᐸunique_author_countᐳ"]]:::plan
    PgFromExpression19{{"PgFromExpression[19∈0] ➊<br />More deps:<br />- Constantᐸtrueᐳ[32]"}}:::plan
    Object10 & PgFromExpression19 --> PgSelect17
    PgSelect25[["PgSelect[25∈0] ➊<br />ᐸunique_author_countᐳ"]]:::plan
    PgFromExpression27{{"PgFromExpression[27∈0] ➊<br />More deps:<br />- Constantᐸfalseᐳ[33]"}}:::plan
    Object10 & PgFromExpression27 --> PgSelect25
    __Value2["__Value[2∈0] ➊<br />ᐸcontextᐳ"]:::plan
    __Value2 --> Access8
    __Value2 --> Access9
    First12{{"First[12∈0] ➊"}}:::plan
    PgSelectRows13[["PgSelectRows[13∈0] ➊"]]:::plan
    PgSelectRows13 --> First12
    PgSelect7 --> PgSelectRows13
    PgSelectSingle14{{"PgSelectSingle[14∈0] ➊<br />ᐸunique_author_countᐳ"}}:::plan
    First12 --> PgSelectSingle14
    First20{{"First[20∈0] ➊"}}:::plan
    PgSelectRows21[["PgSelectRows[21∈0] ➊"]]:::plan
    PgSelectRows21 --> First20
    PgSelect17 --> PgSelectRows21
    PgSelectSingle22{{"PgSelectSingle[22∈0] ➊<br />ᐸunique_author_countᐳ"}}:::plan
    First20 --> PgSelectSingle22
    First28{{"First[28∈0] ➊"}}:::plan
    PgSelectRows29[["PgSelectRows[29∈0] ➊"]]:::plan
    PgSelectRows29 --> First28
    PgSelect25 --> PgSelectRows29
    PgSelectSingle30{{"PgSelectSingle[30∈0] ➊<br />ᐸunique_author_countᐳ"}}:::plan
    First28 --> PgSelectSingle30

    %% define steps
    classDef bucket0 stroke:#696969
    class Bucket0,__Value2,PgSelect7,Access8,Access9,Object10,PgFromExpression11,First12,PgSelectRows13,PgSelectSingle14,PgSelect17,PgFromExpression19,First20,PgSelectRows21,PgSelectSingle22,PgSelect25,PgFromExpression27,First28,PgSelectRows29,PgSelectSingle30 bucket0

